package top.revery.task.service;

import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import top.revery.api.entity.user.BaseUserInfo;
import top.revery.task.dto.UserInfoDto;


/**
 * @author denghao
 * @title
 * @package
 * @date 2019/12/12 16:38
 */
@Service
public class UserSerivce  {

    @Autowired
    private UserInfoDto userInfoDto;

    public Page<BaseUserInfo> findPage(int pageNum, int pageSize) {
           PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize);
           return userInfoDto.findAll(pageRequest);
    }
    public BaseUserInfo findByTelephone(String telephone) {
        return userInfoDto.findByTelephone(telephone);
    }
    public BaseUserInfo findByName(String name) {
       return userInfoDto.findByName(name);
    }
    public BaseUserInfo findByEmail(String email) {
        return userInfoDto.findByEmail(email);
    }
}
